/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sbbs.jpa.entity.id;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import org.sbbs.jpa.entity.IdentityBaseEntity;
import static javax.persistence.TemporalType.DATE;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "IDENTITY_ID_ENTITY")
public class IdentityIDEntity extends IdentityBaseEntity {


    private String name;
    private Date birthday = new Date();
    private int sex = 0;

    @Column(length = 50, name = "NAME", nullable = false)
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the birthday
     */
    @Temporal(DATE)
    @Column(name = "BIRTHDAY", length = 19, nullable = false)
    public Date getBirthday() {
        return birthday;
    }

    /**
     * @param birthday the birthday to set
     */
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    /**
     * @return the sexFlag
     */
    @Column(name = "SEX", nullable = false)
    public int getSex() {
        return sex;
    }

    /**
     * @param sexFlag the sexFlag to set
     */
    public void setSex(int sexFlag) {
        this.sex = sexFlag;
    }

    public IdentityIDEntity() {
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
        hash = 41 * hash + (this.birthday != null ? this.birthday.hashCode() : 0);
        hash = 41 * hash + this.sex;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final IdentityIDEntity other = (IdentityIDEntity) obj;
        return true;
    }

    @Override
    public String toString() {
        return "DemoPersonBean{"
                + "id=" + getId()
                + ",name=" + name
                + ", birthday=" + birthday + ", sex=" + sex + '}';
    }

    public IdentityIDEntity(String name, int sex, Date birth) {
        this.name = name;
        this.sex = sex;
        this.birthday = birth;
    }
}
